package com.book.controller;

import com.book.dto.NoticePage;
import com.book.entity.Notice;
import com.book.service.NoticeService;
import com.book.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yicheng
 */
@RestController
@RequestMapping("/notice")
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    @PostMapping("/getList")
    public ResponseResult getList(@RequestBody NoticePage noticePage){
        return noticeService.selectList(noticePage);
    }

    @GetMapping("delete")
    public ResponseResult delete(@RequestParam int id){
        return noticeService.delete(id);
    }

    @GetMapping("getNotice")
    public ResponseResult getNotice(@RequestParam int id){
        return noticeService.getNotice(id);
    }

    @PostMapping("/noticeSave")
    public ResponseResult noticeSave(@RequestBody Notice notice){
        return noticeService.noticeSave(notice);
    }
}
